﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace kysec_MVC.Controllers
{
    public class preIndexController : Controller
    {
        //
        // GET: /preIndex/
        public ActionResult Home() {
            List<kysec.Bll.News.newData> list_News = kysec.Bll.News.Search.getFirstNews(1, 6, 0);
            ViewData["NEWS"] = list_News;//读出新闻信息显示
            List<kysec.RAL.EFToMySql.tb_product> new_Products = kysec.BLL.Production.Search.getNewsProducts(); 
            ViewData["new_Products"] = new_Products;//最新产品显示

            List<kysec.BLL.Production.DemoData> Show_Products_0 = kysec.BLL.Production.Search.getDemoProducts(0, true, 5, 0);
            List<kysec.BLL.Production.DemoData> Show_Products_1 = kysec.BLL.Production.Search.getDemoProducts(1, true, 5, 0);

            List<kysec.BLL.Production.DemoData> Show_Products = Show_Products_0.Concat<kysec.BLL.Production.DemoData>(Show_Products_1).ToList();
            ViewData["Demo_Products"] = Show_Products;

            return View();
        }

        public ActionResult Index()
        {
            List<kysec.RAL.EFToMySql.tb_aboutme> list_CPYC = kysec.Bll.Company.Search.getAllInfoForpre(5);
            ViewData["CPYC"] = list_CPYC;//读出诚聘英才的相关信息

            List<kysec.RAL.EFToMySql.tb_aboutme> list_ZSDL = kysec.Bll.Company.Search.getAllInfoForpre(4);
            ViewData["ZSDL"] = list_CPYC;//读出招商代理的相关信息

            List<kysec.Bll.News.newData> list_News = kysec.Bll.News.Search.getFirstNews(1, 10, 0);
            ViewData["NEWS"] = list_News;//读出新闻信息显示

            List<kysec.BLL.Production.DemoData> new_Products = kysec.BLL.Production.Search.getProductsLeft(0, 5, 0);
            ViewData["new_Products"] = new_Products;//最新产品显示

            List<kysec.BLL.Production.DemoData> xilie_Product = kysec.BLL.Production.Search.getProductsLeft(1, 5, 0);
            ViewData["xilie_Products"] = xilie_Product;//系列产品显示

            List<kysec.BLL.Production.DemoData> Show_Products_0 = kysec.BLL.Production.Search.getDemoProducts(0, true, 2, 0);
            List<kysec.BLL.Production.DemoData> Show_Products_1 = kysec.BLL.Production.Search.getDemoProducts(1,true, 2, 0);

            List<kysec.BLL.Production.DemoData> Show_Products = Show_Products_0.Concat<kysec.BLL.Production.DemoData>(Show_Products_1).ToList();
            ViewData["Show_Products"] = Show_Products;//左上角的图片显示

            List<kysec.BLL.Production.DemoData> Demo_Products = kysec.BLL.Production.Search.getDemoProducts(0,true, 2, 0);
            ViewData["Demo_Products"] = Demo_Products;
            return View();
        }

    }
}
